package com.das.mechanic_base.adapter.main;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import com.das.mechanic_base.bean.main.ReceiveStatusBean;
import com.das.mechanic_base.mvp.view.create.fragment.X3ServiceListFragment;

import java.util.ArrayList;
import java.util.List;

public class ServiceListAdapter extends FragmentStatePagerAdapter {

    private List<ReceiveStatusBean> mList;

    public ServiceListAdapter(@NonNull FragmentManager fm) {
        super(fm);
        this.mList = new ArrayList<>();
    }

    public void changeFragment(List<ReceiveStatusBean> mList) {
        this.mList = mList;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
        super.destroyItem(container, position, object);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return X3ServiceListFragment.newInstance(mList.get(position),position);
    }
}
